<?php
/*
 * @Author: your name
 * @Date: 2020-01-06 11:12:37
 * @LastEditTime : 2020-01-06 16:36:49
 * @LastEditors  : Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /ahsmp_3/application/common/service/HostGuiseConfig.php
 */

namespace app\common\service;


class HostGuiseConfig extends Base 

{
    /**
     * @name: 查找单个
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2020-01-06 11:13:40
     */
    function findOne ($host_id)
    {
        $return = db('HostGuiseConfig')->where('host_id', $host_id)->find();

        return $return;
    }

        /**
     * @name: 系统伪装
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2019-10-31 16:47:34
     */
    function onOff ($host_id, $status)
    {
        db('HostGuiseConfig')->whereIn('host_id', $host_id)->update(['guise_status' => $status]);
    }

    /**
     * @name: 查询列表
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2020-01-06 11:45:54
     */
    function selectByHostId($host_id_a, $field = '*')
    {
        $return = db('HostGuiseConfig')->field($field) ->whereIn('host_id', $host_id_a)->select();

        return $return;
    }
    /**
     * @name: 添加
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2020-01-06 16:34:29
     */
    function add ($host_id)
    {
        if(db('HostGuiseConfig')->where('host_id', $host_id)->count())
        {
            return [];
        }
        db('HostGuiseConfig')->insert(['host_id' => $host_id]);
    }
}